package com.outstanding.his.symptom.dao.impl;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.outstanding.his.symptom.dao.ISymptomDao;
import com.outstanding.his.symptom.domain.Symptom;

public class HibernateSymptomDao extends HibernateDaoSupport implements
		ISymptomDao {

	@Override
	public Symptom submitSymptom(Symptom symptom) throws DataAccessException {
		this.getHibernateTemplate().saveOrUpdate(symptom);
		return symptom;
	}

	@Override
	public Symptom getSymptom(Integer symptomId) throws DataAccessException {
		Symptom symptom = (Symptom) this.getSession().load(Symptom.class,
				symptomId);
		return symptom;
	}

	@Override
	public Symptom getSymptomByPatientId(Integer patientId)
			throws DataAccessException {
		Symptom symptom = (Symptom) this.getSession().load(Symptom.class,
				patientId);
		return symptom;
	}
}
